#define _CRT_SECURE_NO_WARNINGS 1
#include"Head.h"
class Solution {
public:
    int lengthOfLongestSubstring(string s) {
        if (s == "") return 0;
        int countTable[128] = { 0 }, len = 1;
        int left = 0, right = 0;
        while (right < s.size())
        {
            countTable[s[right]]++;
            while (countTable[s[right]] > 1)
            {
                countTable[s[left]]--;
                left++;
            }
            len = max(right - left + 1, len);
            right++;
        }
        return len;
    }
};